package com.example.venue_reservation_service.controller;

import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.example.venue_reservation_service.domain.School;
import com.example.venue_reservation_service.service.SchoolService;
import com.example.venue_reservation_service.vo.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/school")
@Api("认证数据管理")
@CrossOrigin
public class SchoolController {

    @Resource
    private SchoolService schoolService;

    @ApiOperation("加载认证单位列表")
    @GetMapping("/units")
    public Result units(@RequestParam("type") String type){
        return schoolService.queryUnits(type);
    }

    @ApiOperation("用户认证")
    @PostMapping("/certify")
    public Result certify(@RequestBody School school){
        return schoolService.userCertify(school);
    }

    @ApiOperation("获取用户认证信息")
    @GetMapping("/detail/{userId}")
    public Result detail(@PathVariable("userId") Integer userId){
        return schoolService.getCertify(userId);
    }

}
